﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FtpWorkerRole.FtpServer;

namespace FtpWorkerRole.FtpCommand
{
    public class PassCommand : CommandBase
    {
        public PassCommand(FtpSocketHandler handler)
            : base(handler)
        {
            commandName = "PASS";
        }

        public override void execute(string value)
        {
            if (handler.login(handler.user, value))
            {
                Utils.sendMessage(handler.getSocket(), formatMessage(220, "Welcome!"));
            }
            else
            {
                Utils.sendMessage(handler.getSocket(), formatMessage(530, "Login Incorrect."));
            }
        }
    }
}
